<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Examine/order_bond_list')}">保证金列表</a></li>
			<li class="active"><a>操作保证金</a></li>
		</ul>
        <form class="form-horizontal js-ajax-form" action="{:U('Examine/fksave')}" method="post">
			<fieldset>
				<div class="tabbable">
					<div class="tab-content">
						
							<fieldset>
								<div class="control-group">
									<label class="control-label">姓名</label>
									<div class="controls">
										<php>$ds=array('0'=>'<span style="color:red">未认证</span>','1'=>'<span style="color:green">已认证</span>','2'=>'<span style="color:red">认证未通过</span>','3'=>'<span style="color:red">暂时不需要</span>')</php>
										<label class="control-label" style="width:auto">{$order.name}&nbsp&nbsp&nbsp&nbsp{$ds[$order['account_status']]}</label>
										<input type="hidden" name="options[id]" value="{$order.id}">
										<input type="hidden" name="options[ob_id]" value="{$order.ob_id}">
										<input type="hidden" name="options[user_id]" value="{$order.user_id}">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">手机号码</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.mobile}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">银行卡号</label>
									<div class="controls">
									<label class="control-label" style="width:auto">{$order.bank}：{$order.silver_card}&nbsp&nbsp&nbsp&nbsp预留手机号码&nbsp&nbsp{$order.silver_number}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">借款金额</label>
									<div class="controls">
									<label class="control-label" style="width:auto">{$order.amount}元</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">借款天数</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.loan_day}天</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">分期数</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.stages}期</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">咨询费</label>
									<div class="controls">
									<label class="control-label" style="width:auto">{$order.interest}元</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">审核费</label>
									<div class="controls"><label class="control-label" style="width:auto">{$order.examine}元</label></div>
								</div>
								<div class="control-group">
									<label class="control-label">顾问费</label>
									<div class="controls"><label class="control-label" style="width:auto">{$order.consulting}元</label></div>
								</div>
								<div class="control-group">
									<label class="control-label">保证金</label>
									<div class="controls"><label class="control-label" style="width:auto">{$order.bond_amount}元</label></div>
								</div>
								<div class="control-group">
									<label class="control-label">到期应还</label>
									<div class="controls"><label class="control-label" style="width:auto">{$order.loan_amount}元</label></div>
								</div>
								<if condition="($log)">
								<div class="control-group">
									<label class="control-label">借款审核信息</label>
									<div class="controls">
									<label class="control-label" style="width:auto">
										<table border="1" style='text-align:center;width:800px' cellpadding='10px'>
											<tr>
												<th>审核类型</th>
												<th>审核时间</th>
												<th>审核人</th>
												<th>审核备注</th>
												<th>审核操作</th>
											</tr>
											<php>$stu_type=array('1'=>'借款中','2'=>'已还款','3'=>'逾期','4'=>'已到期','5'=>'审核中','6'=>'审核不通过','7'=>'驳回','8'=>'放款成功','9'=>'放款不成功','10'=>'待放款');
											$stu_ty=array('0'=>'用户审核','1'=>'订单审核','2'=>'用户信息审核','3'=>'续期审核','4'=>'逾期还款(本金)','5'=>'逾期还款','6'=>'订单审核');
											</php>
											<foreach name="log" item="vo">
												<tr>
													<td>{$stu_ty[$vo['types']]}</td>
													<td>{$vo.crtime}</td>
													<td>{$users[$vo['examine_id']]}</td>
													<td>{$vo.message}</td>
													<td>{$vo['status']?'审核成功':'审核失败'}</td>
												</tr>
											</foreach>
										</table>
									</label>
									</div>
								</div>
								</if>
								<if condition="($logs)">
								<div class="control-group">
									<label class="control-label">客户审核信息</label>
									<div class="controls">
									<label class="control-label" style="width:auto">
										<table border="1" style='text-align:center;width:800px' cellpadding='10px'>
											<tr>
												<th>审核类型</th>
												<th>审核时间</th>
												<th>审核人</th>
												<th>审核备注</th>
												<th>审核操作</th>
											</tr>
											<php>$stu_type=array('1'=>'借款中','2'=>'已还款','3'=>'逾期','4'=>'已到期','5'=>'审核中','6'=>'审核不通过','7'=>'驳回','8'=>'放款成功','9'=>'放款不成功','10'=>'待放款');
											$stu_ty=array('0'=>'用户审核','1'=>'订单审核','2'=>'用户信息审核','3'=>'续期审核','4'=>'逾期还款(本金)','5'=>'逾期还款','6'=>'订单审核');
											</php>
											<foreach name="logs" item="vo">
												<eq name="vo.types" value="2">
												<tr>
													<td>{$stu_ty[$vo['types']]}</td>
													<td>{$vo.crtime}</td>
													<td>{$users[$vo['examine_id']]}</td>
													<td>{$vo.message}</td>
													<td>{$vo['status']?'审核成功':'审核失败'}</td>
												</tr>
												</eq>
											</foreach>
										</table>
									</label>
									</div>
								</div>
								</if>
								<div class="control-group">
									<label class="control-label">实际放款金额</label>
									<div class="controls"><label class="control-label" style="width:auto">{$order['amount']-$order['interest']-$order['examine']-$order['consulting']-$order['bond_amount']-10}元</label>
									<label class="control-label" style="width:auto">&nbsp&nbsp* 平台需要扣手续费10元</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">是否已经归还</label>
									<div class="controls">
										<input type="radio" name="is_back" value="0">否
										<input type="radio" name="is_back" value="1">是
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">操作说明</label>
									<div class="controls">
										<textarea name="op_record"></textarea>
									</div>
								</div>
							</fieldset>
					</div>
				</div>

				<div class="form-actions">
					<button class="btn btn-primary js-ajax-submit" type="submit" data-types='1' data-action="{:U('Examine/op_order_bond')}" data-msg='确认操作?' data-subcheck="true">确认操作</button>
				</div>
			</fieldset>
		</form>
		
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
<script type="text/javascript">
	var ajaxForm_list = $('form.js-ajax-form');
	if (ajaxForm_list.length) {
	    Wind.use('ajaxForm', 'artDialog', function () {
	        $('button.js-ajax-submit').bind('click', function (e) {

	            e.preventDefault();
	            /*var btn = $(this).find('button.js-ajax-submit'),
						form = $(this);*/
	            var btn = $(this),
	                form = btn.parents('form.js-ajax-form');
	
	            //批量操作 判断选项
	            if (btn.data('subcheck')) {
	                btn.parent().find('span').remove();
					var msg = btn.data('msg');
					if (msg) {
						art.dialog({
							id: 'warning',
							icon: 'warning',
							content: btn.data('msg'),
							cancelVal: "{:L('CLOSE')}",
							cancel: function () {
								
							},
							button :[ {
											name : "{:L('OK')}",
											callback:function(){
												ajaxSubmit(btn.data('types'));
											},
											focus : true
									} ]
						});
					} else {
						btn.data('subcheck', false);
						btn.click();
					}
	                return false;
	            }
	        });
	
	    });
	}
	function ajaxSubmit(type){
	    var is_back = $('input[name=is_back]:checked').val();
	    if('undefined'==typeof(is_back)){
	        alert('必须选择保证金是否已经归还!');
	    	return ;
		}
			var btn = $('button.js-ajax-submit'),
			form = btn.parents('form.js-ajax-form');
			form.ajaxSubmit({
	                url: type ? btn.data('action') : form.attr('action'),
	                //按钮上是否自定义提交地址(多按钮情况)
	                dataType: 'json',
	                beforeSubmit: function (arr, $form, options) {
						var tx=type ? '确认操作' : '确认操作';
	                    //按钮文案、状态修改
	                    btn.text(tx + '中...').attr('disabled', true).addClass('disabled');
	                },
	                success: function (data, statusText, xhr, $form) {
	                    //按钮文案、状态修改
	                    btn.removeClass('disabled').parent().find('span').remove();
	
	                    if (data.state === 'success') {
	                        $('<span class="tips_success">' + data.info + '</span>').appendTo(btn.parent()).fadeIn('slow').delay(1000).fadeOut(function () {
	                            if (data.referer) {
	                                //返回带跳转地址
	                                if (window.parent.art) {
	                                    //iframe弹出页
	                                    window.parent.location.href = data.referer;
	                                } else {
	                                    window.location.href = data.referer;
	                                }
	                            } else {
	                                if (window.parent.art) {
	                                    reloadPage(window.parent);
	                                } else {
	                                    //刷新当前页
	                                    reloadPage(window);
	                                }
	                            }
	                        });
	                    } else if (data.state === 'fail') {
	                        $('<span class="tips_error">' + data.info + '</span>').appendTo(btn.parent()).fadeIn('fast');
	                        btn.removeProp('disabled').removeClass('disabled');
	                    }
	                }
	            });
	}
	</script>
</html>